The present invention relates to a signal processing method and apparatus for processing a code word, and more particularly, to a signal processing method and apparatus suitably usable for processing a code word resulted from coding of a video signal.
In the conventional edition of a digital signal such as a still image, time-varying image, etc. (will be referred to simply as xe2x80x9cimagexe2x80x9d hereinafter), one entire frame of the image is used as an edition unit. Especially, in case of a digital signal having been subjected to a variety of conversions such as compression, color space conversion, etc., the entire image is inversely converted back to its original signal (e.g., RGB signal), the original signal is edited and then reconverted. Generally, a digital signal of an image is compressed for transmission or storage since it includes a vast amount of data.
Referring now to FIG. 1, there is illustrated a procedure of editing one image frame of a so-called digital video (DV) signal. The edition of an image coded by the entropy coding or the like is shown.
As shown in FIG. 1, a digital signal supplied from a tape or hard disc is subjected to entropy decoding (at step S101), dequantization (at step S102), inverse discrete cosine transform (DCT) (at step S103) and RGB conversion block synthesis (at step S104), and data thus reconstituted is edited (at step S105).
The edited data is inversely converted. That is, it is subjected to YCbCr conversion blocking (at step S106), DCT (at step S107), quantization (at step S108) and entropy coding (at step S109).
Note that since an upper limit of code amount is determined for each of units forming together compressed video data such as DV signal compressed as in the above, the extent of compression has to be so controlled that the compressed video data can be accommodated in the code amount.
For example, the code amount in one video segment of a DV signal is set at a fixed length smaller than a predetermined code amount. Thus, conventionally, the code amount is controlled by making smaller the quantizer number in units of macro block for a rougher quantization, and Huffman coding being a variable-length coding, of the smaller quantizer number.
By this method, however, the video data is compressed more than necessary and the code amount becomes much smaller than a target code amount as the case may be, with a result that the image quality will be deteriorated more than necessary. In producing a high definition image in the fields of medicine, art and motion picture, for example, non-compressed video data is used for fear of an image quality degradation. Especially since repeated synthesis of video data will lead to a cumulation of image quality degradation, there is a tendency that use of a compressed video data will be avoided in such applications.
If a target code amount is not reached even by a one-step rougher quantization, it is necessary to repeat the quantization and variable-length coding until the target code amount is reached, which has been a large burden to the signal processing.
If the image quality degradation due to the expansion and recompression can be solved, it is expectable that the compression of video data such as a so-called DV signal will widely be accepted in the video edition.
Accordingly, the present invention has an object to overcome the above-mentioned drawbacks of the prior art by providing a signal processing method and apparatus in which an image quality can be maintained and signal processing such as quantization and variable-length coding be only a small burden in processing a code word of compressed video data.
The above object can be attained by providing a signal processing method in which an input signal is quantized to provide a sequence and the sequence is converted to a string of code words by variable-length coding of the sequence, including according to the present invention: a step of replacing one code word of the code word string with some other code word shorter than the one code word and having a value approximate to that of the one code word.
Also the above object can be attained by providing a signal processor in which an input signal is quantized to provide a sequence and the sequence is converted to a code word string by variable-length coding of the sequence, including according to the present invention: means for replacing one code word of the code word string with some other code word shorter than the one code word and having a value approximate to that of the one code word.